﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	导渗系统（每月）
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        DateTime date = (DateTime)ViewData["date"];
        DateTime originalDate = (DateTime)ViewData["originalDate"];
        
    %>
    <div class="screen_area">
        <form method="Get" action="/Query/Drain">
        <div>
        <%if ((bool)ViewData["showFactory"])
            {%>
        请选择公司：<%= Html.DropDownList("factoryId", ViewData["factories"] as List<SelectListItem>, "请选择公司", new { onchange = "showStacks();" })%>
        <span style="margin-left:20px"></span>
        <%
            }
            else
            {
        %>
        <%=Html.Hidden("factoryId", ViewData["factoryId"]) %>
        <%
            }
        %>
        <label>请选择堆场/尾矿库：</label><span id="stackList"><%= Html.DropDownList("stackId", ViewData["stacksAndTailingponds"] as List<SelectListItem>, "请选择")%></span>
        <span style="margin-left:20px"></span>
        <label>查询日期：</label><span><input type="text" name="date" id="date" size="12" value="<%=originalDate.Year %>-<%=originalDate.Month %>-<%=originalDate.Day %>" class="ipt_date" readonly="readonly" /></span>
        <span><input type="submit" value="查  询" /></span>
        </div>
        </form>
    </div>
    <div style="margin-top:10px;margin-bottom:10px"></div>
    <div id="dolphincontainer">
	    <div id="dolphinnav">
	        <ul class="top_tab">
                <li><a href="/Query/StackWater?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>水位及水质</span></a></li>
                <li><a href="/Query/BackWater?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>进浆及回水</span></a></li>
                <li><a href="/Query/Settle?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>沉降及位移</span></a></li>
                <li><a href="/Query/Ardealite?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"] %>&factoryId=<%=ViewData["factoryId"] %>"><span>磷石膏堆积坝</span></a></li>
                <li><a href="/Query/Ditch?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"]%>&factoryId=<%=ViewData["factoryId"] %>"><span>截洪沟</span></a></li>
                <li><a href="/Query/PiezometerWell?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"]%>&factoryId=<%=ViewData["factoryId"] %>"><span>浸润线观测</span></a></li>
                <li><a href="/Query/PiezometerBase?stackId=<%=ViewData["stackId"]%>&date=<%=(DateTime)ViewData["originalDate"]%>&factoryId=<%=ViewData["factoryId"] %>"><span>渗压观测</span></a></li>
                <li><a href="javascript:return(false);" class="current"><span>导渗系统</span></a></li>
	        </ul>
	    </div>
	</div>

    <% 
        Dictionary<Drain_system_basic_info, List<Drain_system_outlet_info>> drainOutlets = (Dictionary<Drain_system_basic_info, List<Drain_system_outlet_info>>)ViewData["drainOutlets"];
        DateTime preDate = originalDate.AddMonths(-1);
        DateTime nextDate = originalDate.AddMonths(1);
        
    %>

    <div class="dataarea">
        <a class="arrow_l" href="/Query/Drain?stackId=<%=ViewData["stackId"]%>&date=<%=preDate%>&factoryId=<%=ViewData["factoryId"] %>" title="前一月">前一月</a>
        <strong><%= date.Year%>年<%=date.Month%>月</strong><%if (originalDate.Date < DateTime.Now.Date && (originalDate.Date.Year < DateTime.Now.Date.Year || originalDate.Date.Month < DateTime.Now.Date.Month)){ %>
        <a class="arrow_r" href="/Query/Drain?stackId=<%=ViewData["stackId"]%>&date=<%=nextDate%>&factoryId=<%=ViewData["factoryId"] %>" title="后一月">后一月</a><%} %>
    </div>
    
    <table cellpadding="4" cellspacing="0" class="com_from_table">

        <tr>
            <td class="lab" style="width:120px;">测量人员：</td>
            <td>
                <%
                    User tester = (User) ViewData["tester"];
                    if (tester != null)
                    {
                %>
                <%=tester.RealName + " (" + tester.Name + ")"%>
                <%
                    }
                %>&nbsp;&nbsp;
            </td>
        </tr>

    </table>

    
    <% if (drainOutlets != null && drainOutlets.Count > 0)
        {
            int i = 1;
            foreach (KeyValuePair<Drain_system_basic_info, List<Drain_system_outlet_info>> drain in drainOutlets)
            {
                List<Drain_system_outlet_info> outlets = drain.Value;
                List<Drain_system_Monthly_info> outletRecords = (List<Drain_system_Monthly_info>)ViewData["drainRecords" + i];
                   
    %>

    <table cellpadding="4" cellspacing="0" class="com_from_table3">
        
        <tr>
            <th colspan="9">El.<%=drain.Key.El %>m 高程导渗系统监测表<%if (!string.IsNullOrEmpty(drain.Key.Pic_filepath)){ %> <a href="<%=Url.Content(drain.Key.Pic_filepath) %>" target="_blank">(查看导渗系统出水口)</a><%} %></th>
        </tr>
             
        <tr>
            <th style="width:65px; text-align:center;">组别</th>
            <th style="width:85px; text-align:center;">出水口编号</th>
            <th style="width:85px; text-align:center;">对应导渗段</th>
            <th style="width:165px; text-align:center;">是否为导渗段仅有出水口</th>
            <th style="width:125px; text-align:center;">是否为溢流出水口</th>
            <th style="width:145px; text-align:center;">测量流量（m<sup>3</sup>/sec）</th>
            <th style="width:85px; text-align:center;">出水颜色</th>
            <th style="width:85px; text-align:center;">结垢状况</th>
            <th>备注</th>
        </tr>

        <%
            if (outlets != null & outlets.Count > 0)
            {
                for (int j = 0; j < outlets.Count; j++)
                {
                    bool hasRecord = outletRecords != null && outletRecords.Count > j;
        %>
        <tr>
            <td style="text-align:center; vertical-align:middle;"><%=outlets[j].Drain_outlet_group_no%></td>
            <td style="text-align:center;"><%=outlets[j].Drain_outlet_no%></td>
            <td style="text-align:center;"><%=outlets[j].Drain_outlet_section_no%></td>
            <td style="text-align:center;"><%=(outlets[j].Is_sole_outlet.HasValue && outlets[j].Is_sole_outlet.Value == 1 ? "是" : "")%></td>
            <td style="text-align:center;"><%=(outlets[j].Is_seepage_outlet.HasValue && outlets[j].Is_seepage_outlet.Value == 1 ? "是" : "")%></td>
            <td style="text-align:center;"><%if (hasRecord && outletRecords[j].Rate_Of_Flow.HasValue){%><%=outletRecords[j].Rate_Of_Flow.Value.ToString()%><%}%>&nbsp;</td>
            <td style="text-align:center;">
                <%if(hasRecord && outletRecords[j].Color_of_Flow.HasValue && outletRecords[j].Color_of_Flow.Value == 1){%>正常<%} %>
                <%if(hasRecord && outletRecords[j].Color_of_Flow.HasValue && outletRecords[j].Color_of_Flow.Value == 2){%>略微混浊<%} %>
                <%if(hasRecord && outletRecords[j].Color_of_Flow.HasValue && outletRecords[j].Color_of_Flow.Value == 3){%>混浊<%} %>
                <%if(hasRecord && outletRecords[j].Color_of_Flow.HasValue && outletRecords[j].Color_of_Flow.Value == 4){%>严重混浊<%} %>
            </td>
            <td style="text-align:center;">
                <%if(hasRecord && outletRecords[j].Deposit.HasValue && outletRecords[j].Deposit.Value == 1){%>无<%} %>
                <%if(hasRecord && outletRecords[j].Deposit.HasValue && outletRecords[j].Deposit.Value == 2){%>轻微<%} %>
                <%if(hasRecord && outletRecords[j].Deposit.HasValue && outletRecords[j].Deposit.Value == 3){%>典型<%} %>
                <%if(hasRecord && outletRecords[j].Deposit.HasValue && outletRecords[j].Deposit.Value == 4){%>严重<%} %>
            </td>
            <td style="text-align:center;"><%=outlets[j].Is_In_Normal_Use.HasValue && outlets[j].Is_In_Normal_Use.Value != 1 ? "该出水口已不能正常监测" : "&nbsp;"%></td>
        </tr>
        <%
                }
            }
        %>

    </table>


    <%
                i++;
            }
        }
    %>
    <script type="text/javascript" language="javascript">
        $('#date').datepicker({ changeMonth: true, changeYear: true });

        function showStacks() {
            var factoryId = document.getElementById("factoryId").value;
            if (factoryId == "" || factoryId == 0) return;
            $.ajax({ 
                    type: "POST",
                    url: "<%=Url.Content("~/Modification/ListStacks") %>",
                    data: "factoryId=" + factoryId,
                    success: function (data) { $("#stackList").html(data);}
            });
        }
    </script>
</asp:Content>
